// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

.step
  display: flex
  align-items: flex-start

  &:not(:last-child)
    margin-right: $cs.l

    .content > .title::after
      display: block

  &.vertical
    position: relative

    &:not(:last-child)
      margin-right: 0

      .tail::after
        display: block

      .content > .title::after
        display: none

.tail
  position: absolute
  top: 0
  left: 1rem
  width: 1px
  height: 100%
  padding-top: 'calc(%s + 2rem)' % $cs.xs
  padding-bottom: $cs.xs
  padding-left: 0
  padding-right: 0
  box-sizing: border-box

  &::after
    background: var(--c-bg-neutral-semilight)
    width: 1px
    height: 100%
    border-radius: 1px
    content: ''
    display: none

.active
  .status,
  .content > .title
    font-weight: $fw.bold

.current
  .status
    color: var(--c-bg-neutral-min)
    background-color: var(--c-text-brand-normal)

  .content > .title
    color: var(--c-text-neutral-heavy)

  .content > .description
    color: var(--c-text-neutral-heavy)

.wait
  .status
    opacity: .7
    background-color: var(--c-bg-neutral-min)
    border: 1px solid var(--c-text-neutral-light)
    color: var(--c-text-neutral-light)

  .content > .title
    color: var(--c-text-neutral-light)

  .content > .description
    color: var(--c-text-neutral-light)

.success
  .status
    background-color: var(--c-text-brand-normal)
    color: var(--c-bg-neutral-min)

  .content > .title
    color: var(--c-text-neutral-heavy)

  .content > .description
    color: var(--c-text-neutral-light)

  .content > .title::after,
  .tail::after
    background: var(--c-text-brand-normal)

.success.transition-failed
  .content > .title::after,
  .tail::after
    background: var(--c-bg-error-normal)

.failure
  .status
    background-color: var(--c-bg-error-normal)
    color: var(--c-bg-neutral-min)

  .content > .title,
  .content > .description
    color: var(--c-bg-error-normal)

.status
  height: 2rem
  width: 2rem
  border-radius: 2rem
  text-align: center
  margin-right: $cs.xs
  transition: background-color $ad.m
  box-sizing: border-box

  .label
    nudge('down', 2px)

.content
  flex: 1
  overflow: hidden

  .title
    nudge('down', 2.5px)
    white-space: nowrap
    color: var(--c-text-neutral-heavy)
    padding-right: $cs.l

    &::after
      content: ''
      position: absolute
      display: none
      top: 50%
      left: 100%
      width: 9999px
      height: 1px
      background: var(--c-bg-neutral-semilight)
      transition: background $ad.s

  .description
    font-size: $fs.s
    color: var(--c-text-neutral-light)
    margin-bottom: $cs.m
    margin-top: 0
    max-width: $ls.xxl

+media-query($bp.xs)
  .step
    position: relative

    &:not(:last-child)
      margin-right: 0

      .tail::after
        display: block

      .content > .title::after
        display: none
